<?php

/*
 * Created on Dec 6, 2011
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
if ($_POST["filepath"]) {

	include_once ("httpsqs/httpsqs_client.php");
	$httpsqs_host = "localhost";
	$httpsqs_port = "1218";
	$httpsqs_auth = "";
	$httpsqs_charset = "utf-8";
	$httpsqs = new httpsqs($httpsqs_host, $httpsqs_port, $httpsqs_auth, $httpsqs_charset);
	//curl -d "dtncp /home/hao/test.txt dtn://hao.bytewalla.com"  "http://localhost:1218/?charset=utf-8&name=&opt=put"

	$cmd = "dtncpd " . $_POST["filepath"];
	//echo $cmd;
	$result = $httpsqs->reset("c_php_reply");
	
	$result = $httpsqs->put("text_java_request", $cmd);
	
	
	while(1){
		$result = $httpsqs->get("c_php_reply");
		if($result != "HTTPSQS_GET_END" && $data != "HTTPSQS_ERROR"){
			echo $result;
			break;
		}
	}	
	
}
?>
